package week8;

public class HeapQueue<T> extends ArrayHeap<HeapQueueObject<T>> {
    // 创建一个空的优先级队列。
    public HeapQueue()
    {
        super();
    }

    // 添加新的元素
    public void enqueue(T object)
    {
        HeapQueueObject<T> obj = new HeapQueueObject<T>(object);
        super.addElement(obj);
    }

    // 从优先队列中删除下一个最高优先级元素，并返回对它的引用。
    public T dequeue()
    {
        HeapQueueObject<T> obj = (HeapQueueObject<T>)super.removeMin();
        return obj.getElement();
    }

    public T first()
    {
        HeapQueueObject<T> queueObject = (HeapQueueObject<T>) super.findMin();
        return  queueObject.getElement();
    }

    public boolean isEmpty()
    {
        return super.isEmpty();
    }

    public int size()
    {
        return  super.size();
    }

    public String toString()
    {
        return super.toString();
    }
}
